#pragma once
#include <string>
#include <vector>

namespace CG
{
class Serial
{
    const static int BUFFERSIZE = 1024;
    const static int BAUDRATE = 115200;

  public:
    Serial(int bufferSize = BUFFERSIZE);
    ~Serial();
    bool Open(std::string device, int rate = BAUDRATE);
    bool Close();

    int Read(unsigned char *buffer, int size);
    int Write(unsigned char *buffer, int size);

  private:
    int fd;
};
} // namespace CG
